<template>
  <div class="homegrid">
    <grid>
      <template>
        <grid-item @click.native="goTab(index)" v-for="(item,index) in datas" :key="item.id" col="20%">
          <template #img>
            <div class="img">
              <img :src="item.img" @load="imgLoad" alt="">
            </div>
          </template>
          <template #text>
            <div class="text">
              {{item.text}}
            </div>
          </template>
        </grid-item>
        
      </template>
    </grid>
  </div>
</template>

<script>
import Grid from "components/public/grid/Grid";
import GridItem from "components/public/grid/GridItem";
export default {
  name: "HomeGrid",
  props:{
    datas:Array
  },
  components:{
    Grid,
    GridItem
  },
  methods:{
    goTab(index){
      this.$router.push({
        path:'/tab',
        query:{
          categrayId:index
        }
      })
    },
    imgLoad(){
      this.$bus.$emit('imgLoad')
      
    }
  }
};
</script>

<style lang="less" scoped>

</style>